home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / gcc / gcc261c.zoo / objects / KeyedCollecting.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-11-18  |  3.9 KB  |  117 lines

  1. /* Protocol for Objective-C objects holding (keyElement,contentElement) pairs.
  2.    Copyright (C) 1993,1994 Free Software Foundation, Inc.
  3.  
  4.    Written by:  R. Andrew McCallum <mccallum@gnu.ai.mit.edu>
  5.    Date: May 1993
  6.  
  7.    This file is part of the GNU Objective C Class Library.
  8.  
  9.    This library is free software; you can redistribute it and/or
  10.    modify it under the terms of the GNU Library General Public
  11.    License as published by the Free Software Foundation; either
  12.    version 2 of the License, or (at your option) any later version.
  13.    
  14.    This library is distributed in the hope that it will be useful,
  15.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  16.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  17.    Library General Public License for more details.
  18.  
  19.    You should have received a copy of the GNU Library General Public
  20.    License along with this library; if not, write to the Free
  21.    Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. */ 
  23.  
  24. /* The <KeyedCollecting> protocol inherits from the <Collecting> protocol.
  25.  
  26.    The <KeyedCollecting> protocol defines the interface to a
  27.    collection of elements that are accessible by a key, where the key is
  28.    some unique element.  Pairs of (key element, content element) may be
  29.    added, removed and replaced.  The keys and contents may be tested,
  30.    enumerated and copied.  
  31. */
  32.  
  33. #ifndef __KeyedCollecting_h_OBJECTS_INCLUDE
  34. #define __KeyedCollecting_h_OBJECTS_INCLUDE
  35.  
  36. #include <objects/stdobjects.h>
  37. #include <objects/Collecting.h>
  38.  
  39. @protocol KeyedCollecting <Collecting>
  40.  
  41. // ADDING;
  42. - putObject: newContentObject atKey: (elt)aKey;
  43.  
  44. // REPLACING AND SWAPPING;
  45. - replaceObjectAtKey: (elt)aKey with: newContentObject;
  46. - swapAtKeys: (elt)key1 : (elt)key2;
  47.  
  48. // REMOVING;
  49. - removeObjectAtKey: (elt)aKey;
  50.  
  51. // GETTING ELEMENTS AND KEYS;
  52. - objectAtKey: (elt)aKey;
  53. - keyObjectOfObject: aContentObject;
  54.  
  55. // TESTING;
  56. - (BOOL) includesKey: (elt)aKey;
  57.  
  58. // ENUMERATIONS;
  59. - withKeyObjectsCall: (void(*)(id))aFunc;
  60. - withKeyObjectsAndContentObjectsCall: (void(*)(id,id))aFunc;
  61. - withKeyObjectsAndContentObjectsCall: (void(*)(id,id))aFunc 
  62.     whileTrue: (BOOL *)flag;
  63.  
  64. // ENUMERATING WHILE CHANGING CONTENTS;
  65. - safeWithKeyObjectsCall: (void(*)(id))aFunc;
  66. - safeWithKeyObjectsAndContentObjectsCall: (void(*)(id,id))aFunc;
  67. - safeWithKeyObjectsAndContentObjectsCall: (void(*)(id,id))aFunc 
  68.     whileTrue: (BOOL *)flag;
  69.  
  70.  
  71. // NON-OBJECT ELEMENT METHOD NAMES;
  72.  
  73. // INITIALIZING;
  74. - initWithType: (const char *)contentsEncoding
  75.     keyType: (const char *)keyEncoding;
  76. - initKeyType: (const char *)keyEncoding;
  77.  
  78. // ADDING;
  79. - putElement: (elt)newContentElement atKey: (elt)aKey;
  80.  
  81. // REPLACING;
  82. - (elt) replaceElementAtKey: (elt)aKey with: (elt)newContentElement;
  83. - (elt) replaceElementAtKey: (elt)aKey with: (elt)newContentElement
  84.     ifAbsentCall: (elt(*)(arglist_t))excFunc;
  85.  
  86. // REMOVING;
  87. - (elt) removeElementAtKey: (elt)aKey;
  88. - (elt) removeElementAtKey: (elt)aKey ifAbsentCall: (elt(*)(arglist_t))excFunc;
  89.  
  90. // GETTING ELEMENTS AND KEYS;
  91. - (elt) elementAtKey: (elt)aKey;
  92. - (elt) elementAtKey: (elt)aKey ifAbsentCall: (elt(*)(arglist_t))excFunc;
  93. - (elt) keyElementOfElement: (elt)aContentObject;
  94. - (elt) keyElementOfElement: (elt)aContentObject
  95.     ifAbsentCall: (elt(*)(arglist_t))excFunc;
  96.  
  97. // TESTING;
  98. - (const char *) keyType;
  99.  
  100. // ENUMERATING;
  101. - (BOOL) getNextKey: (elt*)aKeyPtr content: (elt*)anElementPtr 
  102.   withEnumState: (void**)enumState;
  103. - withKeyElementsCall: (void(*)(elt))aFunc;
  104. - withKeyElementsAndContentElementsCall: (void(*)(elt,elt))aFunc;
  105. - withKeyElementsAndContentElementsCall: (void(*)(elt,elt))aFunc 
  106.     whileTrue: (BOOL *)flag;
  107.  
  108. // ENUMERATING WHILE CHANGING CONTENTS;
  109. - safeWithKeyElementsCall: (void(*)(elt))aFunc;
  110. - safeWithKeyElementsAndContentElementsCall: (void(*)(elt,elt))aFunc;
  111. - safeWithKeyElementsAndContentElementsCall: (void(*)(elt,elt))aFunc 
  112.     whileTrue: (BOOL *)flag;
  113.  
  114. @end
  115.  
  116. #endif /* __KeyedCollecting_h_OBJECTS_INCLUDE */
  117.